package com.lzw.bluetoothpractice.Adapters;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.lzw.bluetoothpractice.R;
import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.List;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;


public class VideoAdapter extends CommonAdapter<String> {
    private Context mContext;

    public VideoAdapter(Context context, List<String> datas, int layoutId) {
        super(context, layoutId, datas);
        this.mContext = context;
    }

    @Override
    protected void convert(ViewHolder viewHolder, String url, int position) {
        JCVideoPlayerStandard player = viewHolder.getView(R.id.player_list_video);
       /* if (player != null) {
            player.release();
        }*/
        boolean setUp = player.setUp(url, JCVideoPlayer.SCREEN_LAYOUT_LIST, "");
        if (setUp) {
            Glide.with(mContext).load("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1597467535278&di=fad0bafda01770498ddbed533d7d7b3f&imgtype=0&src=http%3A%2F%2Fimg.mp.sohu.com%2Fupload%2F20170816%2F81b8f57c7dbc4cef902c45aef8b71aeb_th.png").into(player.thumbImageView);
        }
        //player.startButton.performClick();
    }
}